{extend name="Layout/edit" /}
{block name="content"}
<!-- form start -->
<form action="{:url('editSave')}" method="post" enctype="multipart/form-data" class="form-horizontal">
    <div class="box-body">
        <div class="form-group">
            <label class="col-sm-2 control-label">商品类别</label>
            <div class="col-sm-10">
                <select name="category_id" class="form-control input-sm" data-url="{:url('ProductCategory/getTreeJson')}" data-value="{$data.category_id}"></select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">商品名称</label>
            <div class="col-sm-10">
                <input type="text" name="title" class="form-control input-sm" placeholder="商品名称" value="{$data.title}" title="{$data.title}" required="required" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">商品型号</label>                        
            <div class="col-sm-10">
                <input type="text" name="marque" class="form-control input-sm" placeholder="商品型号" value="{$data.marque}" title="商品型号" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">商品价格</label>
            <div class="col-sm-10">
                <input type="text" name="price" class="form-control input-sm" value="{$data.price|default=0}"  placeholder="商品价格" required="required" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">市场价格</label>
            <div class="col-sm-10">
                <input type="text" name="market_price" class="form-control input-sm" value="{$data.market_price|default=0}"  placeholder="市场价格" required="required" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">商品图片</label>
            <div class="col-sm-10">
                <div class="input-group">
                    <input type="text" name="picture_url" class="form-control input-sm"  placeholder="商品图片" value="{$data.picture_url}">
                    <span class="input-group-btn">
                        <a href="{:url('Uploader/delete')}" class="btn btn-default btn-sm xsui-btn-singlefile-delete-image" title="删除图片">删除</a>
                        <a href="{:url('Uploader/single_file','name=picture_url')}" class="btn btn-default btn-sm xsui-btn-singlefile-uploader-image" title="选择图片并上传">上传</a>
                    </span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">摘要内容</label>
            <div class="col-sm-10">
                <textarea name="summary" class="form-control input-sm" placeholder="摘要内容" data-uploadurl="{:url('Uploader/kindeditor_upload')}">{$data.summary}</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">发布时间</label>
            <div class="col-sm-5">
                <div class="input-group date xsui-datetimepicker" data-link-field="create_time">
                    <input type="text" name="create_time" class="form-control input-sm" value="{$data.create_time|default=date('Y-m-d H:i:s')}" placeholder="发布时间" />
                    <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                    <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">状态</label>
            <div class="col-sm-10">
                {xshtml:radio name="status" data='array("1"=>"上架","0"=>"下架")' value="data['status']|default='1'" /}
            </div>
        </div>
    </div>
    <!-- /.box-body -->
    <div class="box-footer">
        <button type="button" class="btn btn-default xsui-btn-close-dialog">取消</button>
        <button type="submit" class="btn btn-primary pull-right">保存</button>
    </div>
    <!-- /.box-footer -->
    <input type="hidden" name="id" value="{$data.id}"/>
</form>
{/block}
{block name="script_after"}
<script>
    $('select[name="category_id"]').ajaxcombobox({first: {id: "", text: "选择类别"}});
</script>
{/block}
